home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Save Command
- Sent: 6/25/96 3:10 PM
- Received: 6/25/96 3:53 PM
- From: John Casey, jcasey@ncs-ssc.com
- Reply-To: ODF Interest, ODF-Interest@cilabs.org
- To: OpenDoc Development Framework Discussion List, ODF-Interest@cilabs.
-
- >I hope others will weigh in with their opinions. Unfortunately, I don't
- >think there is currently a clean way to do this. On the Mac, You could
- >make up a dummy menu event record and call ODDispatcher::Dispatch().
- >You'd need to set the "what" field to kODEvtMenu, ask the current menu
- >bar for the menu and item number corresponding to the save command, and
- >put them in the high and low word of the message field, respectively.
- >Ouch!
-
- I attempted to implement your suggestion; however, I still could not get
- it to work. Below is a code sniplet of my command's DoIt method.
-
- void CSaveCmd::DoIt(Environment* ev)
- {
- // Create the platform event
- FW_CFrame* frame = this->GetFrame(ev);
- FW_ASSERT(frame != kODNULL);
- ODEventData eventData;
- FW_CPart* part = frame->GetPart(ev);
- FW_ASSERT(part != kODNULL);
- #ifdef FW_BUILD_MAC
- FW_CMenuBar* menuBar = part->GetMenuBar(ev);
- FW_ASSERT(menuBar != kODNULL);
- FW_CAcquiredODMenuBar aqODMenuBar = menuBar->AcquireODMenuBar(ev);
- FW_ASSERT(aqODMenuBar != kODNULL);
- ODMenuID menuID;
- ODMenuItemID menuItem;
- aqODMenuBar->GetMenuAndItem(ev, kODCommandSave, &menuID, &menuItem);
- eventData.what = kODEvtMenu;
- eventData.message = menuID << 16;
- eventData.message |= menuItem;
- #endif
- #ifdef FW_BUILD_WIN
- eventData.message = kODEvtMenu;
- eventData.wParam = kODCommandSave;
- #endif
-
- // Dispatch the "Save" command
- ODSession* odSession = part->GetSession(ev);
- FW_ASSERT(odSession != kODNULL);
- ODDispatcher* odDispatcher = odSession->GetDispatcher(ev);
- FW_ASSERT(odDispatcher != kODNULL);
- odDispatcher->Dispatch(ev, &eventData);
- }
-
-
- ========================================================================
- John Casey email: jcasey@ncs-ssc.com
- Vice President web: http://www.ncs-ssc.com
- Nation Computer Services voice: (804) 378-8917
- fax: (601) 689-8130
- ========================================================================
-